﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI.WebControls;

namespace QuickDev.Localization
{
    public class LocalizationUtility
    {
        #region Methods

        #region Public

        /// <summary>
        /// Adds the hover HTML.
        /// </summary>
        /// <param name="hyperlink">The hyperlink.</param>
        /// <param name="html">The HTML.</param>
        public static void AddHoverHtml( HyperLink hyperlink , string html )
        {
            hyperlink.Attributes.Add( "onmouseover" , string.Format( Overlib.SIMPLE , html ) );
            hyperlink.Attributes.Add( "onmouseout" , Overlib.MOUSEOUT );
        }


        /// <summary>
        /// Adds the image alternate text.
        /// </summary>
        /// <param name="image">The image.</param>
        public static void AddImageAlternateText( System.Web.UI.WebControls.Image image )
        {
            image.AlternateText = labels.ResourceManager.GetString( image.ID );
        }

        /// <summary>
        /// Gets the text.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <returns></returns>
        public static string GetText( string name )
        {
            return labels.ResourceManager.GetString( name );
        }

        /// <summary>
        /// Gets the store string.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <returns></returns>
        public static string GetStoreString( string name )
        {
            return Strings.ResourceManager.GetString( name );
        }

        /// <summary>
        /// Gets the help text.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <returns></returns>
        public static string GetHelpText( string name )
        {
            return help.ResourceManager.GetString( name );
        }

        /// <summary>
        /// Gets the critical message text.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <returns></returns>
        public static string GetCriticalMessageText( string message )
        {
            return string.Format( GetText( "lblCriticalError" ) , message );
        }

        /// <summary>
        /// Gets the payment provider error text.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <returns></returns>
        public static string GetPaymentProviderErrorText( string message )
        {
            return string.Format( GetText( "lblPaymentProviderError" ) , message );
        }

        #endregion

        #endregion
    }
}
